package com.hhit.zhgd.task.factory

import org.quartz.spi.TriggerFiredBundle
import org.springframework.beans.factory.annotation.Autowired
import org.springframework.context.ApplicationContext
import org.springframework.scheduling.quartz.SpringBeanJobFactory
import org.springframework.stereotype.Component

@Component
class AutowiringSpringBeanJobFactory:SpringBeanJobFactory() {
    @Autowired
    private lateinit var applicationContext: ApplicationContext

    override fun createJobInstance(bundle: TriggerFiredBundle): Any {
        val job = super.createJobInstance(bundle)
        applicationContext.autowireCapableBeanFactory.autowireBean(job)
        return job
    }
}